import React , { Component }from 'react'

export default function HocRouter(Com) {
    return class HocRouter extends Component {
        //在挂载阶段判断本地有没有token值
        componentDidMount(){
            const token = localStorage.getItem("token")
            if (!token) {
                console.log(this.props);
                this.props.history.push("/login")
            }
        }
        render() {
            return (
                <Com {...this.props}>
                    
                </Com>
            )
        }
    }
}
